//
//  RightViewController.m
//  LeftRightSlider
//
//  Created by Zhao Yiqi on 13-11-27.
//  Copyright (c) 2013年 Zhao Yiqi. All rights reserved.
//

#import "RightViewController.h"
#import "RecentMentionsVC.h"

@interface RightViewController ()<UITableViewDataSource,UITableViewDelegate>
{
    UITableView *_tableView;
    NSArray *_titleArray;
}

@end

@implementation RightViewController

- (id)initWithNibName:(NSString *)nibNameOrNil bundle:(NSBundle *)nibBundleOrNil
{
    self = [super initWithNibName:nibNameOrNil bundle:nibBundleOrNil];
    if (self) {
        // Custom initialization
    }
    return self;
}

- (void)viewDidLoad
{
    [super viewDidLoad];
    
    UIImageView *imgV=[[UIImageView alloc] initWithFrame:self.view.bounds];
//    [imgV setImage:[UIImage imageNamed:@"2222"]];
    imgV.backgroundColor = [UIColor grayColor];
    [self.view addSubview:imgV];
	// Do any additional setup after loading the view.
    
    _titleArray = [NSArray arrayWithObjects:@"Recent Mentions", @"Your File", @"All File", @"Starred Items", @"Team Directory", @"Settings", @"Switch Teams",nil];
    _tableView = [[UITableView alloc] initWithFrame:CGRectMake(160, 44, SCREEN_WIDTH, SCREEN_HEIGHT-NAVIGATION_CONTROLLER_HEIGHT ) style:UITableViewStylePlain];;
    _tableView.delegate = self;
    _tableView.dataSource = self;
    _tableView.backgroundColor = [UIColor clearColor];
    _tableView.separatorStyle = UITableViewCellSeparatorStyleSingleLine;
    _tableView.showsVerticalScrollIndicator = NO;
    _tableView.tableHeaderView = [[UIView alloc] init];
    _tableView.tableFooterView = [[UIView alloc] init];
    [self.view addSubview:_tableView];
}

- (void)didReceiveMemoryWarning
{
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}

- (NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return [_titleArray count];
}

- (CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    return 40;
}

- (UITableViewCell*)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NSLog(@"====enter cellForRowAtIndexPath====");
    
    static NSString *cellID = @"cellID";
    
    UITableViewCell *cell=[tableView dequeueReusableCellWithIdentifier:cellID];
    if( !cell){
        cell=[[UITableViewCell alloc] initWithStyle:UITableViewCellStyleDefault reuseIdentifier:cellID];
    }
    
    cell.backgroundColor=[UIColor clearColor];
    [cell setSelectionStyle:UITableViewCellSelectionStyleNone];
    cell.selected = YES;
    cell.textLabel.font = [UIFont systemFontOfSize:12.0];
    UIView *view = cell.contentView;
    
    //标题
    {
        UILabel *label = [[UILabel alloc] initWithFrame:CGRectMake(30, 10, 140, 20)];
        switch(indexPath.row){
            case 0:
                label.text = [_titleArray objectAtIndex:indexPath.row];
                break;
            case 1:
                label.text = [_titleArray objectAtIndex:indexPath.row];
                break;
            case 2:
                label.text = [_titleArray objectAtIndex:indexPath.row];
                break;
            case 3:
                label.text = [_titleArray objectAtIndex:indexPath.row];
                break;
            case 4:
                label.text = [_titleArray objectAtIndex:indexPath.row];
                break;
            case 5:
                label.text = [_titleArray objectAtIndex:indexPath.row];
                break;
            case 6:
                label.text = [_titleArray objectAtIndex:indexPath.row];
                break;
            default:
                break;
        }
        
//        label.frame = CGRectMake(0, 10, 140, 20);
        label.font = [UIFont systemFontOfSize:14.0];
        label.textColor = [UIColor colorWithRed:0/255.0 green:0/255.0 blue:0/255.0 alpha:1.0];
        [view addSubview:label];
    }
    
    return cell;
}


-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath
{
    switch (indexPath.row)
    {
        case 0:
        {
            NSLog(@"====enter Recent Mentions====");
            
            RecentMentionsVC *addFriendVtr = [[RecentMentionsVC alloc] init];
            [self.navigationController pushViewController:addFriendVtr animated:YES];
            break;
        }
        case 1:
        {
            NSLog(@"====Your File====");
            
            break;
        }
        case 2:
        {
            NSLog(@"====All File====");

            break;
        }
        case 3:
            NSLog(@"====Starred Items====");
            
            break;
        case 4:
            NSLog(@"====Team Directory====");
            
            break;
        case 5:
            NSLog(@"====Settings====");
            
            break;
        case 6:
            NSLog(@"====Switch Teams====");
            
            break;
        default:
            break;
    }
}

@end
